package com.cssw.fyzb.wap.controller;

import com.cssw.fyzb.base.web.context.UserContext;
import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.base.web.domain.AjaxPage;
import com.cssw.fyzb.wap.model.dto.ListTeamDto;
import com.cssw.fyzb.wap.model.dto.TeamNumDto;
import com.cssw.fyzb.wap.model.vo.FollowNumVo;
import com.cssw.fyzb.wap.model.vo.PublicUserInfoVo;
import com.cssw.fyzb.wap.model.vo.TeamDateCountVo;
import com.cssw.fyzb.wap.service.TeamService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/team")
public class TeamController {
    private static final Logger logger = LoggerFactory.getLogger(UserController.class);

    @Autowired
    private TeamService teamService;


    @ApiOperation(value = "获取团队列表")
    @RequestMapping(value = "/listTeam", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型：0全部 1实名 2未实名", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageNumber", value = "页码, 从1开始", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页大小", paramType = "query", dataType = "int", required = true),

    })
    @ResponseBody
    public AjaxPage<PublicUserInfoVo> listTeam(int type, int pageNumber, int pageSize) {
        return teamService.listTeam(UserContext.getUserId(), pageNumber, pageSize, type);
    }

    @ApiOperation(value = "获取团队人数")
    @GetMapping("getTeamNum")
    public AjaxData<TeamNumDto> getTeamNum() {
        return teamService.getTeamNum(UserContext.getUserId());
    }

    @ApiOperation(value = "获取团队人数列表")
    @GetMapping("listTeamByDate")
    public AjaxPage<TeamDateCountVo> listTeamByDate() {
        return teamService.listTeamByDate(UserContext.getUserId());
    }
}
